/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Sjakk;
import javax.swing.ImageIcon;
/**
 * Programmeringsprosjekt 2011 / Gruppe 2
 * @author Fjogen (Vegard Fjogstad)
 */
public class Bonde extends Brikke {
    public Bonde(String id, String farge, int posX, int posY, boolean startPos){
        super(id, farge, posX, posY, startPos);
        java.net.URL url;
        if(farge.equals("Hvit")){
            url = Bonde.class.getResource("/hBonde.png");
        } else {
            url = Bonde.class.getResource("/sBonde.png");
        }
        icon = new ImageIcon(url);
    }
    @Override public int[][] lovligeFlytt(){
        int x = getPosX();
        int y = getPosY();
        int[][]lovlige;
        if(startPos){
            if(farge.equals("Svart")){
                lovlige = new int[][] {
                {x+1, y},
                {x+1, y-1},
                {x+1, y+1},
                {x+2, y}
                };
                return lovlige;
            }

            else{
                lovlige = new int[][] {
                {x-1, y},
                {x-1, y-1},
                {x-1, y+1},
                {x-2, y}
                };
            }
            return lovlige;
        }

        else{
            if(farge.equals("Svart")){
                lovlige = new int[][] {
                {x+1, y},
                {x+1, y-1},
                {x+1, y+1}
                };
                return lovlige;
            }

            else{
                lovlige = new int[][] {
                {x-1, y},
                {x-1, y-1},
                {x-1, y+1}
                };
            }
        }
        return lovlige;
    }
}
